{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e9482efe",
   "metadata": {},
   "source": [
    "# week01\n",
    "* 下载anaconda\n",
    "* 尝试运行Python第一行代码print\"hello world\"\n",
    "* 观察标准库\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "422f3afa",
   "metadata": {},
   "source": [
    "## 函数＋模块=标准库\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9791d60",
   "metadata": {},
   "source": [
    "### 观察标准库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "108d8710",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'win32'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import sys\n",
    ">>> sys.platform  #sys模块可以了解运行解释器的系统"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "53c63707",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]\n"
     ]
    }
   ],
   "source": [
    ">>> print(sys.version) #了解运行Python的哪个版本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "cbf62ba0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'e:\\\\jupyter_notebook\\\\week01'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import os #在os模块中调用函数\n",
    ">>> os.getcwd() #调用getcwd函数会返回当前工作目录，帮助找出代码所在文件夹名字"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "cbc3f022",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "environ{'ALLUSERSPROFILE': 'C:\\\\ProgramData',\n",
       "        'APPDATA': 'C:\\\\Users\\\\86180\\\\AppData\\\\Roaming',\n",
       "        'COMMONPROGRAMFILES': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMMONPROGRAMFILES(X86)': 'C:\\\\Program Files (x86)\\\\Common Files',\n",
       "        'COMMONPROGRAMW6432': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMPUTERNAME': 'LAPTOP-2UMQPC6J',\n",
       "        'COMSPEC': 'C:\\\\WINDOWS\\\\system32\\\\cmd.exe',\n",
       "        'DRIVERDATA': 'C:\\\\Windows\\\\System32\\\\Drivers\\\\DriverData',\n",
       "        'HOMEDRIVE': 'C:',\n",
       "        'HOMEPATH': '\\\\Users\\\\86180',\n",
       "        'LOCALAPPDATA': 'C:\\\\Users\\\\86180\\\\AppData\\\\Local',\n",
       "        'LOGONSERVER': '\\\\\\\\LAPTOP-2UMQPC6J',\n",
       "        'NUMBER_OF_PROCESSORS': '8',\n",
       "        'ONEDRIVE': 'C:\\\\Users\\\\86180\\\\OneDrive',\n",
       "        'OS': 'Windows_NT',\n",
       "        'PATH': 'C:\\\\Windows\\\\system32;C:\\\\Windows;C:\\\\Windows\\\\System32\\\\Wbem;C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\;C:\\\\Windows\\\\System32\\\\OpenSSH\\\\;C:\\\\Program Files (x86)\\\\NVIDIA Corporation\\\\PhysX\\\\Common;C:\\\\Program Files\\\\NVIDIA Corporation\\\\NVIDIA NvDLISR;C:\\\\WINDOWS\\\\system32;C:\\\\WINDOWS;C:\\\\WINDOWS\\\\System32\\\\Wbem;C:\\\\WINDOWS\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\;C:\\\\WINDOWS\\\\System32\\\\OpenSSH\\\\;E:\\\\anaconda3;E:\\\\anaconda3\\\\Library\\\\mingw-w64\\\\bin;E:\\\\anaconda3\\\\Library\\\\usr\\\\bin;E:\\\\anaconda3\\\\Library\\\\bin;E:\\\\anaconda3\\\\Scripts;C:\\\\Users\\\\86180\\\\AppData\\\\Local\\\\Microsoft\\\\WindowsApps',\n",
       "        'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',\n",
       "        'PROCESSOR_ARCHITECTURE': 'AMD64',\n",
       "        'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 140 Stepping 2, GenuineIntel',\n",
       "        'PROCESSOR_LEVEL': '6',\n",
       "        'PROCESSOR_REVISION': '8c02',\n",
       "        'PROGRAMDATA': 'C:\\\\ProgramData',\n",
       "        'PROGRAMFILES': 'C:\\\\Program Files',\n",
       "        'PROGRAMFILES(X86)': 'C:\\\\Program Files (x86)',\n",
       "        'PROGRAMW6432': 'C:\\\\Program Files',\n",
       "        'PROMPT': '$P$G',\n",
       "        'PSMODULEPATH': 'C:\\\\Program Files\\\\WindowsPowerShell\\\\Modules;C:\\\\WINDOWS\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\Modules',\n",
       "        'PUBLIC': 'C:\\\\Users\\\\Public',\n",
       "        'SESSIONNAME': 'Console',\n",
       "        'SYSTEMDRIVE': 'C:',\n",
       "        'SYSTEMROOT': 'C:\\\\WINDOWS',\n",
       "        'TEMP': 'C:\\\\Users\\\\86180\\\\AppData\\\\Local\\\\Temp',\n",
       "        'TMP': 'C:\\\\Users\\\\86180\\\\AppData\\\\Local\\\\Temp',\n",
       "        'USERDOMAIN': 'LAPTOP-2UMQPC6J',\n",
       "        'USERDOMAIN_ROAMINGPROFILE': 'LAPTOP-2UMQPC6J',\n",
       "        'USERNAME': '86180',\n",
       "        'USERPROFILE': 'C:\\\\Users\\\\86180',\n",
       "        'WINDIR': 'C:\\\\WINDOWS',\n",
       "        'ZES_ENABLE_SYSMAN': '1',\n",
       "        'JPY_INTERRUPT_EVENT': '3036',\n",
       "        'IPY_INTERRUPT_EVENT': '3036',\n",
       "        'JPY_PARENT_PID': '2916',\n",
       "        'TERM': 'xterm-color',\n",
       "        'CLICOLOR': '1',\n",
       "        'PAGER': 'cat',\n",
       "        'GIT_PAGER': 'cat',\n",
       "        'MPLBACKEND': 'module://ipykernel.pylab.backend_inline'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> os.environ #使用environ属性，可以访问系统的全部环境变量/也可使用getenv单独访问某一个环境变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5575af3f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2021, 11, 16)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import datetime\n",
    ">>> datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c605ecee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.today().day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "ef91bf03",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2021-11-16'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.isoformat(datetime.date.today()) #调用date.isoformat函数，将今天日期转换为一个字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "08384302",
   "metadata": {},
   "source": [
    "## 占位符\n",
    "* 占位符%s既可以表示字符串，还可以表示整数int,浮点数float"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "f5db0789",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入您的姓名：陈海静\n",
      "请输入您的年龄：19\n",
      "请输入您的职位：学生\n",
      "请输入您的身高：160\n",
      "请输入您的联系方式：1800000\n",
      "姓名：陈海静\n",
      "年龄：19岁\n",
      "身高：160.00cm\n",
      "职位：学生\n",
      "联系方式：1800000\n"
     ]
    }
   ],
   "source": [
    "username = input(\"请输入您的姓名：\")\n",
    "userage = input(\"请输入您的年龄：\")\n",
    "jobPosition = input(\"请输入您的职位：\")\n",
    "userHeight = input(\"请输入您的身高：\")\n",
    "phonenum = input(\"请输入您的联系方式：\")\n",
    "\n",
    "print(\"姓名：%s\"%(username)) # 占位符%s既可以表示字符串，还可以表示整数int,浮点数float\n",
    "print(\"年龄：%d岁\"%(int(userage))) # 年龄是以整数int的形式呈现，也可以以小数的形式呈现，可以用%d/%f\n",
    "                            # 占位符%f既可以表示整数（保留6位小数），也可以表示浮点数float\n",
    "print(\"身高：%.2fcm\"%(float(userHeight)))\n",
    "print(\"职位：%s\"%(jobPosition))\n",
    "print(\"联系方式：%d\"%(int(phonenum)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b6bdb421",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
